/**
 * Created by fangshufeng on 2017/9/15.
 */

import  React from  'react';

import LoginButton from './LoginButton';

export  default  class  LoginControl extends React.Component {

    constructor(){
        super();
        this.state = {
            isLogin:false,
        }
    }

    onClick = () => {
        if(this.state.isLogin) {
            this.setState({
               isLogin:false,
            });
        }else  {
            this.setState({
                isLogin:true,
            });
        }
    }
    render(){
        return(
            <LoginButton text={this.state.isLogin ? 'login' : 'logout'} onClick={this.onClick}/>
        );
    }
}